# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Eric Belanger <eric@archlinux.org>
# Contributor: William Rea <sillywilly@gmail.com>

pkgname=fontforge
pkgver=20230101
pkgrel=3
pkgdesc='Outline and bitmap font editor'
url='https://fontforge.github.io/'
arch=('x86_64')
license=('BSD')
makedepends=('cmake' 'git' 'python-sphinx')
depends=('libtool' 'pango' 'giflib' 'libtiff' 'libxml2' 'libspiro' 'python'
         'potrace' 'woff2' 'gtk3' 'libuninameslist')
source=("https://github.com/${pkgname}/${pkgname}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.xz"
        fontforge-doc-no-warn-error.patch)
sha256sums=('ca82ec4c060c4dda70ace5478a41b5e7b95eb035fe1c4cf85c48f996d35c60f8'
            'b87fa5a39d6948262d2dfb9b84c2462dc21de0bfb115cdd13e893c1b533d8f78')

prepare() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	mkdir build
	patch -Np1 -i ../fontforge-doc-no-warn-error.patch
}

build() {
	cd "${srcdir}/${pkgname}-${pkgver}/build"
	cmake \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DENABLE_MAINTAINER_TOOLS=TRUE \
		-DENABLE_FONTFORGE_EXTRAS=TRUE \
		-DUNIX=TRUE \
		..

	make
}

package() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	cd build
	make DESTDIR="${pkgdir}" install
	install -Dm644 ../LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
